//
//  ELHomeTitleButton.swift
//  SinaWeiBo
//
//  Created by jiwang on 15/12/20.
//  Copyright © 2015年 jiwang. All rights reserved.
//

import UIKit

class ELHomeTitleButton: UIButton {
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        titleLabel?.frame.origin.x = 0
        imageView?.frame.origin.x = (titleLabel?.frame.width)! + 5
    }
    
    class func creatWith (titleName : String , imageName : String) -> ELHomeTitleButton {
        
        let button = ELHomeTitleButton()
        button.setTitle(titleName, forState: UIControlState.Normal)
        button.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        button.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        button.sizeToFit()
        return button
    }
}
